package com.eastdigit.system.model;

import net.sf.json.JSONObject;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class User extends Entity implements IUser, Serializable {
	
	public static final String TYPE_COMMONS = "1";
	public static final String TYPE_CUSTOMER = "2";
	
    private String id;

    private String code;

    private String name;

    private String gender;

    private String telephone;

    private String mobile1;

    private String mobile2;

    private String email;

    private String password;

    private String state;

    private String deptId;

    private String sourceId;

    private String type;

    private String extra1;

    private String extra2;

    private Map<String, Object> map = new HashMap<String, Object>();

//    private List<Menu> permissions = new ArrayList<Menu>();
//
//    private JSONObject dataScope;// 数据范围

    private static final long serialVersionUID = 1L;

    public JSONObject toJSONObject() {
        JSONObject json = new JSONObject();
        json.put("id", id);
        json.put("code", code);
        json.put("name", name);
        json.put("gender", gender);
        json.put("telephone", telephone);
        json.put("mobile1", mobile1);
        json.put("mobile2", mobile2);
        json.put("email", email);
        json.put("state", state);
        json.put("type", type);
        json.put("deptId", deptId);
        json.put("sourceId", sourceId);
        json.put("extra1", extra1);
        json.put("extra2", extra2);
        return json;
    }

    @Override
    public String getMobile() {
        return mobile1;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getMobile1() {
        return mobile1;
    }

    public void setMobile1(String mobile1) {
        this.mobile1 = mobile1;
    }

    public String getMobile2() {
        return mobile2;
    }

    public void setMobile2(String mobile2) {
        this.mobile2 = mobile2;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    @Override
    public String getSourceId() {
        return sourceId;
    }

    public void setSourceId(String sourceId) {
        this.sourceId = sourceId;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getExtra1() {
        return extra1;
    }

    public void setExtra1(String extra1) {
        this.extra1 = extra1;
    }

    public String getExtra2() {
        return extra2;
    }

    public void setExtra2(String extra2) {
        this.extra2 = extra2;
    }

//    public List<Menu> getPermissions() {
//        return permissions;
//    }
//
//    public void addPermissions(List<Menu> permissions) {
//        this.permissions.addAll(permissions);
//    }
//
//    public JSONObject getDataScope() {
//        return dataScope;
//    }
//
//    public void setDataScope(JSONObject dataScope) {
//        this.dataScope = dataScope;
//    }

    @Override
    public Object getCached(String key) {
        return map.get(key);
    }

    @Override
    public void cache(String key, Object value) {
        map.put(key, value);
    }
}
